package model.mapping;

import java.util.HashMap;
import java.util.Map;

import model.map.GameTile;
import model.resource.ResourceTriplet;

public class ResourceMapping
{
	private Map<GameTile, ResourceTriplet> resourcesOnMap;
	
	private static ResourceMapping resourceMapping = new ResourceMapping();
	
	public ResourceMapping()
	{
		resourcesOnMap = new HashMap<GameTile, ResourceTriplet>();
	}
	
	public void addResource (GameTile tile, ResourceTriplet rt)
	{
		resourcesOnMap.put(tile, rt);
	}
	
	public int getFood(GameTile tile)
	{
		ResourceTriplet rt = resourcesOnMap.get(tile);
		return rt.getFoodAmount();
	}
	
	public int getEnergy(GameTile tile)
	{
		ResourceTriplet rt = resourcesOnMap.get(tile);
		return rt.getEnergyAmount();
	}
	
	public int getOre(GameTile tile)
	{
		ResourceTriplet rt = resourcesOnMap.get(tile);
		return rt.getOreAmount();
	}
	
	public int harvestFood(GameTile tile, int amount)
	{
		ResourceTriplet rt = resourcesOnMap.get(tile);
		return rt.harvestFood(amount);
	}
	
	public int harvestEnergy(GameTile tile, int amount)
	{
		ResourceTriplet rt = resourcesOnMap.get(tile);
		return rt.harvestEnergy(amount);
	}
	
	public int harvestOre(GameTile tile, int amount)
	{
		ResourceTriplet rt = resourcesOnMap.get(tile);
		return rt.harvestOre(amount);
	}
	
	public static ResourceMapping getResourceMapping()
	{
		return resourceMapping;
	}
}
